﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace SortCompare
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Display dis = GenerateDataPoints();

            Application.Run(dis);
        }

        private static Display GenerateDataPoints()
        {
            Random rng = new Random();
            Display dis = new Display();
            int[] arraySizes = { 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536 };
            int[][] unsortedArrays = new int[arraySizes.Length][];
            //generate the arrays
            for (int i = 0; i < arraySizes.Length; i++)
            {
                int[] array = new int[arraySizes[i]];

                for (int j = 0; j < arraySizes[i]; j++)
                {
                    array[j] = rng.Next(arraySizes[i] * 2);
                }
                unsortedArrays[i] = array;
            }
            //create the SortTimes object and sort them
            dis.AddData( new SortTimes(MergeSort.Sort, unsortedArrays) );
            dis.AddData( new SortTimes(Quicksort.Sort, unsortedArrays) );
            dis.AddData( new SortTimes(BackwardsQuicksort.Sort, unsortedArrays) );
            //add data to the display

            return dis;
        }

    }
}
